﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace BiztalkConfigLoader.Model
{
    public class ReceiveHandlerTypeConverter:TypeConverter
    {
        public override object ConvertTo(ITypeDescriptorContext context,   System.Globalization.CultureInfo culture, object value, Type destinationType)

        {//This method is used to shown information in the PropertyGrid.

            if (destinationType == typeof(string))

            {

                return ((Model.BtsAdminConfigurationAdapterReceiveHandler)value).hostname ;

            }

            return base.ConvertTo(context, culture, value, destinationType);

        }

 

        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)

        {

            return TypeDescriptor.GetProperties(typeof(BtsAdminConfigurationAdapterReceiveHandler), attributes).Sort(new string[] { "hostname" });

        }

 

        public override bool GetPropertiesSupported(ITypeDescriptorContext context)

        {

            return true;

        }

    }

    }
